# @Time    : 2022/7/15 10:53
# @Author  : mobai
# @Email   : 3111283671@qq.com
# @File    : tset_mkgl_kh_011.py
# @Software: PyCharm


import unittest
from selenium import webdriver  # 引入模块 webdriver
from time import sleep  # 引入模块 sleep
from selenium.webdriver.common.by import By  # 引入模块 By
from selenium.webdriver.support.select import Select

driver = webdriver.Chrome()  # 打开浏览器
driver.maximize_window()  # 窗口最大化
driver.get("http://192.168.1.151/crm")  # 访问CRM网址
# 登录
username_logcator = (By.NAME, "name")
passwrod_logcator = (By.NAME, "password")
login_btn_logcator = (By.NAME, "submit")
driver.find_element(*username_logcator).send_keys("admin")
driver.find_element(*passwrod_logcator).send_keys("admin")
driver.find_element(*login_btn_logcator).click()
# 点击客户，进入客户页面
KH = (By.LINK_TEXT, "客户")
driver.find_element(*KH).click()
# 点击客户统计
KHTJ = (By.XPATH, "/html/body/div[5]/div[1]/ul/li[5]/a")
driver.find_element(*KHTJ).click()
# 点击来源统计图
LYTJ = (By.ID, "show_source")
driver.find_element(*LYTJ).click()
sleep(3)
# 点击更多选项
GDXX = (By.CSS_SELECTOR, '#highcharts-0 > svg > g.highcharts-button')
driver.find_element(*GDXX).click()
sleep(1)
# 点击打印图标
DYTB = (By.XPATH, "//*[@id='highcharts-0']/div/div/div[1]")
driver.find_element(*DYTB).click()
sleep(1)
# 退出浏览器
driver.quit()


